<!DOCTYPE html>
<html lang="zh-CN">
  <head>

	  <include file="Public:header"/>
    <!--[if lt IE 9]>
      <script src="//cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="//cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  <body>
 	<include file="Public:body_top"/>

    <div class="container-fluid">
      <div class="row">
        <div class="col-sm-3 col-md-2 sidebar hidden-xs">
          <div class="menu">
            <dl>
              <dt><i class="cm-order"></i>小程序设置</dt>
              <dd><a href="{:U('Admins/app_edit')}">小程序配置</a></dd>
            </dl>
            <dl>
              <dt><i class="cm-advert"></i>广告管理</dt>
              <dd><a href="{:U('Admins/adverts_index')}">广告列表</a></dd>
              <dd><a href="{:U('Admins/advert_new')}">新建广告</a></dd>
            </dl>
          </div>
        </div>
        <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
          <div class="main-hd">
            <h5>编辑管理员</h5>
          </div>

          <div class="main-bd">
            <div class="form-box" >
              <form class="form-horizontal" id="myform" method="post" enctype="multipart/form-data" action="{:U('Admins/update')}" onsubmit="return validata();">
                <div class="form-group">
                  <label class="col-sm-2 control-label"  >管理员名称</label>
                  <div class="col-sm-8">
                    <input type="text" class="form-control" name="name" id="name" required value="{$admin.name}">
                  </div>
                </div>
                <div class="form-group">
                  <label class="col-sm-2 control-label"  >原始的管理员密码</label>
                  <div class="col-sm-8">
                    <input type="password" class="form-control" name="old_passwd" required id="old_passwd">
                  </div>
                </div>
                <div class="form-group">
                  <label class="col-sm-2 control-label"  >新的管理员密码</label>
                  <div class="col-sm-8">
                    <input type="password" class="form-control" name="passwd" id="passwd" placeholder="若不修改无需输入">
                  </div>
                </div>
                <div class="form-group">
                  <label class="col-sm-2 control-label"  >账号（联系电话）</label>
                  <div class="col-sm-2">
                    <input type="text" class="form-control" name="phone" id="phone" required value="{$admin.phone}">
                  </div>
                </div>
                <div class="form-group">
                  <div class="col-sm-offset-2 col-sm-10">
                    <input type="hidden" name="id" value="{$admin.id}">
                    <input type="submit" class="btn btn-primary" value="提交">
                    <a class="btn btn-default" href="{:U('admins/index')}">返回</a>
                  </div>
                </div>
              </form>
            </div>
          </div>
        </div>
      </div>
    </div>


<script>



function validata()
{

	$("#myform").ajaxSubmit({
		type: 'post', // 提交方式 get/post
		url: "{:U('admins/update')}", // 需要提交的 url
		datatype:"json",
		success: function(data) { // data 保存提交后返回的数据，一般为 json 数据
			// 此处可对 data 作相关处理
			if(data['code']!='success')
			{
			 	save(data['msg']);
			}
			else
			{
				save(data['msg']);
			 	location.href="{:U('admins/app_show')}";
			}


		}
	});

	return false;
}






</script>
  </body>
</html>
